package com.taotao.rest.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.TaotaoResult;
import com.taotao.rest.service.RedisService;

@Controller
@RequestMapping("/cache/sync")
public class RedisController {
	
	@Autowired
	private RedisService redisService;
	
	@RequestMapping("/content/{contentCid}")
	@ResponseBody
	public TaotaoResult synContent(@PathVariable Long contentCid) {
		TaotaoResult result = redisService.synContent(contentCid);
		return result;
	}
	
	@RequestMapping("/itemCat/{itemCatPid}")
	@ResponseBody
	public TaotaoResult synItemCat(@PathVariable Long itemCatPid) {
		TaotaoResult result = redisService.synItemCat(itemCatPid);
		return result;
	}
	
	//Item缓存
	@RequestMapping("/item/{itemId}")
	@ResponseBody
	public TaotaoResult synItem(@PathVariable Long itemId) {
		TaotaoResult result = redisService.synItem(itemId);
		return result;
	}
	
	@RequestMapping("/itemInfo/{itemId}")
	@ResponseBody
	public TaotaoResult synItemInfo(@PathVariable Long itemId) {
		TaotaoResult result = redisService.synItemInfo(itemId);
		return result;
	}
	
	@RequestMapping("/itemDesc/{itemId}")
	@ResponseBody
	public TaotaoResult synitemIDesc(@PathVariable Long itemId) {
		TaotaoResult result = redisService.synitemIDesc(itemId);
		return result;
	}
	
	@RequestMapping("/itemParam/{itemId}")
	@ResponseBody
	public TaotaoResult synItemParam(@PathVariable Long itemId) {
		TaotaoResult result = redisService.synItemParam(itemId);
		return result;
	}
}
